﻿using System;
using System.Windows.Automation;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace QuickUIT.Tests
{
    [TestClass]
    public class AutomationElementExactSearchConditionTests
    {
        [TestMethod]
        [ExpectedException(typeof(ArgumentNullException))]
        public void ShouldThrowExceptionForNullProperty()
        {
            var exactSearchCondition = new AutomationElementExactSearchCondition(null, "Test");
        }

        [TestMethod]
        public void ShouldGetToStringProperty()
        {
            var exactSearchCondition = new AutomationElementExactSearchCondition(AutomationElement.NameProperty, "Test");
            Assert.AreEqual("Name='Test'", exactSearchCondition.ToString());
        }

        [TestMethod]
        public void ShouldGetToStringPropertyWithEmptyValue()
        {
            var exactSearchCondition = new AutomationElementExactSearchCondition(AutomationElement.NameProperty, "");
            Assert.AreEqual("Name=''", exactSearchCondition.ToString());
        }

        [TestMethod]
        public void ShouldGetToStringPropertyForControlTypeExactSearchCondition()
        {
            var exactSearchCondition = new AutomationElementExactSearchCondition(AutomationElement.ControlTypeProperty, ControlType.Window);
            Assert.AreEqual("ControlType='Window'", exactSearchCondition.ToString());
        }
    }
}
